<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<link rel="stylesheet" href="../../static/css/common.css">
<link rel="stylesheet" href="../../static/css/carrierInfo.css">
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<head>
  <meta charset="UTF-8">
  <title>Carrier information</title>
  <!-- 引入样式文件 -->
  <link rel="stylesheet" href="../../static/css/form.css">
</head>
<body>
<!-- 菜单栏 -->
<link rel="stylesheet" href="../../static/css/index.css">
<ul>
  <div th:each="item:${menuList}" class="display:inline-de">
    <li><a th:href="@{${item.path}}" th:text="${item.name}"></a></li>
  </div>
  <a th:href="@{/login}" style="float:right;font-size: 16px;margin: 17px;color: white;">> 登出</a>
</ul>
 <div id="content-carrier" class="form-container" style="padding-bottom: 50px">
   <h2 class="form-title" style="font-family: 幼圆;font-weight: bold" >承运商信息</h2>
    <div class="form">
      <img src="../../static/img/truck.png" style="width: 120px;height: 150px;position: relative;left: 10%">
      <form class="form-content" th:object="${carrier}" >
        <!-- 表单项内容 -->
        <div class="form-row">
          <label>名称</label>
          <span th:text="*{name}"/>
        </div>
        <div class="form-row">
          <label>地址</label>
          <span th:text="*{address}"/>
        </div>
        <div class="form-row">
          <label>电话</label>
          <span th:text="*{phone}"/>
        </div>
        <div class="form-row">
          <label>单位运输价格 元/(吨·千米)</label>
          <span th:text="*{unitPrice}"/>
        </div>

      </form>
    </div>
   <div>
     <h2 class="t2">司机</h2>
     <table class="table table-bordered box-table carrier-table">
       <tr>
         <th>用户名</th>
         <th>司机名</th>
         <th>电话</th>
         <th>电子邮箱</th>
       </tr>
       <tbody>
       <!-- 使用th:each循环渲染后端传入的数据 -->
       <tr th:each="driver : ${carrier.drivers}">
         <td th:text="${driver.userName}"></td>
         <td th:text="${driver.realName}"></td>
         <td th:text="${driver.phone}"></td>
         <td th:text="${driver.email}"></td>
       </tr>
       </tbody>
     </table>
   </div>
   <div>
     <h2 class="t2">货车</h2>
     <table class="table table-bordered box-table carrier-table">
       <thead>
       <tr>
         <th>车牌号</th>
         <th>载重(DWT)</th>
         <th>状态</th>
         <th>信息</th>
       </tr>
       </thead>
       <tbody>
       <!-- 使用th:each循环渲染后端传入的数据 -->
       <tr th:each="truck : ${carrier.trucks}">
         <td th:text="${truck.number}"></td>
         <td th:text="${truck.weight}"></td>
         <td th:switch="${truck.state}">
           <span th:case="0">空闲</span>
           <span th:case="1">使用中</span>
         </td>
         <td th:text="${truck.info}"></td>
       </tr>
       </tbody>
     </table>
   </div>
   <button th:if="${c}" class="submit-button" onclick="goToCarrierUpdatePage()">Update</button>
    <script>
      function goToCarrierUpdatePage() {
        location.href= "/carrier/update";
      }
    </script>
  </div>
</body>
</html>
